<template>
	<view>
		<view>
			<table-title content="报修单详情"></table-title>
			<view class="in-center">
				<small-title content="基本资料"></small-title>
				<view class="state-bar">
					<view class="state-msg">{{state}}</view>
				</view>
			</view>
			<view class="item-table">
				<view-item name="申请人" :value="userMsg.userName"></view-item>
				<view-item name="手机号码" :value="userMsg.userPhone"></view-item>
				<view-item name="租户名称" :value="userMsg.userCompany"></view-item>
				<view-item name="楼盘" :value="userMsg.userBuilding"></view-item>
				<view-item name="单元" :value="userMsg.userRoom" :isLast="true"></view-item>
			</view>
			<view>
				<small-title content="类型"></small-title>
				<radio-group class="radiogroup-style">
					<view class="first-radio">
						<radio :checked="normalChecked" color="#FF0000"></radio>
						<view @click="chooseNormal">普通类型</view>
					</view>
					<view class="second-radio">
						<radio :checked="emergencyChecked" color="#FF0000"></radio>
						<view @click="chooseEmergency">紧急类型</view>
					</view>
				</radio-group>
			</view>
			<view>
				<small-title content="区域"></small-title>
				<radio-group class="radiogroup-style">
					<view class="first-radio">
						<radio :checked="workChecked" color="#FF0000"></radio>
						<view @click="chooseWork">办公区域</view>
					</view>
					<view class="second-radio">
						<radio :checked="publicChecked" color="#FF0000"></radio>
						<view @click="choosePublic">公共区域</view>
					</view>
				</radio-group>
			</view>
			<view>
				<small-title content="问题描述"></small-title>
				<textarea class="textarea-style" maxlength="-1" :disabled="true" :value="problemContent"></textarea>
			</view>
			<view>
				<small-title content="上传图片"></small-title>
				<view style="display: flex;margin-top: 10rpx;">
					<view class="picture-block">
						<image :src="imageUrl[0]" class="picture-style" @click="previewPicture(0)"></image>
					</view>
					<view class="picture-block">
						<image :src="imageUrl[1]" class="picture-style" @click="previewPicture(1)"></image>
					</view>
					<view class="picture-block">
						<image :src="imageUrl[2]" class="picture-style" @click="previewPicture(2)"></image>
					</view>
				</view>
			</view>
			<view>
				<small-title content="处理进度"></small-title>
				<proccess-bar :proccessList="proccessBarList"></proccess-bar>
			</view>
			<view class="mix-button">
				<view class="left-part">
					<button class="left-button">取消</button>
				</view>
				<view class="right-part">
					<button class="right-button">返回</button>
				</view>
			</view>
			<view style="height: 200rpx;"></view>
		</view>
		<!-- <u-tabbar v-model="current" :list="list" :before-switch="clickTabbar"></u-tabbar> -->
	</view>
</template>

<script>
	export default{
		data() {
			return {
				state: '待受理',
				userMsg:{'userName':'李阳','userPhone':'1356137716','userCompany':'福建海峡科技有限公司',
				'userBuilding':'福建八闽大厦','userRoom':'901'},
				normalChecked: true,
				emergencyChecked: false,
				publicChecked: true,
				workChecked: false,
				proccessBarList:[
					{'type':'startCanvas','commentMsg':'发起申请','time':'2021-08-21 11:11:11'}
				],
				problemContent:'墙面渗水，尽快修复',
				imageUrl: ['../../../static/add-logo.svg','../../../static/add-logo.svg',
					'../../../static/add-logo.svg'],
				current: 0
			}
		},
		methods: {
			previewPicture(e){
				console.log(this.imageUrl.slice(e,e+1))
				uni.previewImage({
					urls:this.imageUrl.slice(e,e+1),
					longPressActions:{
						itemList:['发送给朋友','保存图片','收藏']
					}
				})
			},
			chooseEmergency(){
				this.normalChecked = false
				this.emergencyChecked = true
			},
			chooseNormal(){
				this.emergencyChecked = false
				this.normalChecked = true
			},
			choosePublic(){
				this.workChecked = false
				this.publicChecked = true
			},
			chooseWork(){
				this.workChecked = true
				this.publicChecked = false
			},
			clickTabbar(index) {
				switch(index){
					case 0:
						console.log('首页')
						uni.redirectTo({
							url:'/pages/home/home'
						})
						return true
						break
					case 1:
						console.log('楼层管家')
						return true
						break
					case 2:
						console.log('发现')
						return true
						break
					case 3:
						console.log('消息')
						uni.redirectTo({
							url:'/pages/systemAnnoucement/list/list'
						})
						return true
						break
					case 4:
						console.log('我的')
						uni.navigateTo({
							url:'/pages/myPage/myPage'
						})
						return true
						break
				}
			}
		},
	}
</script>

<style>
	page{
		background-color: #F1F1F1
	}
	.state-bar{
		align-items: center;
		color: #FFFFFF;
		background-color: #DD524D;
		width: 160rpx;
		justify-content: flex-end;
		margin-left: auto;
		margin-right: 50rpx;
		font-size: 30rpx;
		border-radius: 50rpx;
		height: 50rpx;
	}
	.state-msg{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.in-center{
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.item-table{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
	.radiogroup-style{
		width: 650rpx;
		height: 100rpx;
		background-color: #FFFFFF;
		display: flex;
		margin-left: 50rpx;
		justify-content: center;
		border: solid 1rpx #C0C0C0;
	}
	.textarea-style{
		display: flex;
		justify-content: center;
		width: 650rpx;
		height: 300rpx;
		margin-left: 50rpx;
		background-color: #FFFFFF;
		border: solid 1rpx #C0C0C0;
	}
	.first-radio{
		display: flex;
		height: 100rpx;
		width: 300rpx;
		align-items: center;
	}
	.second-radio{
		display: flex;
		height: 100rpx;
		align-items: center;
		margin-left: 50rpx;
	}
	.mix-button{
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.left-part{
		float: right;
	}
	.right-part{
		float: left;
	}
	.left-button{
		background-color: #FF0000;
		border-radius: 50rpx 0 0 50rpx;
		color: #FFFFFF;
		width: 300rpx;
		font-size: 30rpx;
	}
	.right-button{
		background-color: #0000FF;
		border-radius: 0 50rpx 50rpx 0;
		color: #FFFFFF;
		width: 300rpx;
		font-size: 30rpx;
	}
	.picture-block{
		display: flex;
		flex-direction: column;
		justify-content: center;
		margin-left: 60rpx;
	}
	.picture-part{
		display: flex;
		margin: 0 0 50rpx 0;
		font-size: 100rpx;
		font-weight: 200;
		align-items: center;
		justify-content: center;	
		width: 170rpx;
		height: 170rpx;
		border: dashed 1rpx #000000;
	}
	.picture-style{
		width: 170rpx;
		height: 170rpx;
		margin: 0 0 10rpx 0rpx;
	}
</style>
